<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>    
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<sj:head jqueryui="true" jquerytheme="redmond"></sj:head>
<script type="text/javascript">
function onButtonClick(){
	window.location = "trustRegionDetailPageAction.action";
}
function onClickCreate(){
	window.location = "trustRegionDetailPageAction.action";
}
$.subscribe('rowselect', function(event, data) {
	/* var grid = event.originalEvent.grid;
	var sel_id = grid.jqGrid('getGridParam', 'selrow');
	var name = grid.jqGrid('getCell', sel_id, 'name');
	
	window.location="trustRegionDetailPageAction.action"; */
	var grid = event.originalEvent.grid;
	var sel_id = grid.jqGrid('getGridParam', 'selrow');
	var isActive = grid.jqGrid('getCell', sel_id, 'status');	
	if(isActive == "false"){
		alert("Do you want to make this Geography active?");	
	}	
	else{
		var trustRegionId = grid.jqGrid('getCell', sel_id, 'trustRegionId');
		var name = grid.jqGrid('getCell', sel_id, 'trustRegionName');
		var description = grid.jqGrid('getCell', sel_id, 'description');
		var countryId = grid.jqGrid('getCell', sel_id, 'countryId');

	window.location="trustRegionDetailPageAction.action?trustRegionName="+name+"&description="+description+"&countryId="+countryId+"&trustRegionId="+trustRegionId;
 		
	}
});
</script>
</head>
<body>
<h3>Trust Region List</h3>
	<s:form  theme="simple">

	<tr>
		<td><a href="<s:url action="geographyAllSearch"/>" >All</a></td>
		<td><a href="<s:url action="geography09Search"/>" >0-9</a></td>
		<td><a href="<s:url action="geographyAESearch"/>" >A B C D E</a></td>
		<td><a href="<s:url action="geographyFJSearch"/>" >F G H I J</a></td>
		<td><a href="<s:url action="geographyKNSearch"/>" >K L M N</a></td>
		<td><a href="<s:url action="geographyORSearch"/>" >O P  Q R</a></td>
		<td><a href="<s:url action="geographySVSearch"/>" >S T U V</a></td>
		<td><a href="<s:url action="geographyWZSearch"/>" >W X Y Z</a></td>
		<td><sj:a button="true" onclick="onClickCreate()" >Create</sj:a></td>
		<td> <s:checkbox name="includeInactive"> Include In-active</s:checkbox> </td>
		
	</tr>
	<sj:dialog id="mybuttondialog"
				buttons="{ 
				    		'OK':function() { okButton(); },
				    		'Cancel':function() { cancelButton(); } 
				    		}"
					autoOpen="false" modal="true" title="Dialog with Buttons">
				     Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque.
				     Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. 
				     Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. 
				     Vestibulum a velit eu ante scelerisque vulputate.
		    </sj:dialog>
	<s:url id="getGeographyUrl" action="getGeographyAction" />
	<sjg:grid id="gridtable" caption="Customer Examples" dataType="json"
		href="%{getGeographyUrl}" pager="true" gridModel="gridModel"
		rowNum="15" rownumbers="true"
		onSelectRowTopics="rowselect">
		<sjg:gridColumn name="trustRegionId"  index="trustRegionId" title="Trust Region Id" sortable="false" hidden="true"/>
		<sjg:gridColumn name="trustRegionName"  index="trustRegionName" title="Trust Region Name" sortable="false" />
		<sjg:gridColumn name="description" index="description" title="Description" sortable="false" />
		<sjg:gridColumn name="countryId" index="countryId" title="Nation/Country" sortable="false" />
		<%-- <sjg:gridColumn name="contact" index="contact" title="Contact" sortable="false" /> --%>
		<sjg:gridColumn name="status" index="status"  title="Is Active?" sortable="false"  />
	</sjg:grid>
</s:form>
</body>
</html>